﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace GPS_DB
{
    class MD5_WFL
    {
        static public byte[] getmd5_string(string source)
        {
            byte[] result = Encoding.Default.GetBytes(source);    //tbPass为输入密码的文本框
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] output = md5.ComputeHash(result);
            return output;
        }
        static public byte[] getmd5_byte(byte[] source)
        {
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] output = md5.ComputeHash(source);
            return output;
        }
        /*
         * 
         * 
         * 
         *  using System.Security.Cryptography;
            using System.Text;

            具体代码如下(写在按钮的Click事件里):
            byte[] result = Encoding.Default.GetBytes(this.tbPass.Text.Trim());    //tbPass为输入密码的文本框
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] output = md5.ComputeHash(result);
            this.tbMd5pass.Text = BitConverter.ToString(output).Replace("-","");  //tbMd5pass为输出加密文本的文本框
         * 
         * 
         * */
    }
}
